<?php
	//session_start();
	//include("../Data/User.php");
	if(isset($_SESSION["user"]) == false)
	{
?>
<form action="inc/xlDangNhap.php" method="post" name="frmLogin">
	<table class="frmlogin" cellpadding="0" cellspacing="0">
		<tr>
			<td colspan="2" align="center"> Đăng nhập</td>
		</tr>
		<tr>
			<td align="right"> Tên đăng nhập: </td>
			<td><input name="txtUID" type="text" id="txtUID" value="admin" size="25" maxlength="30" /></td>
		</tr>
		<tr>
			<td align="right">Mật khẩu:</td>
			<td><input name="txtPWD" type="password" id="PWD" value="admin" size="25" maxlength="30" /></td>
		</tr>
		<tr>
			<td></td>
			<td><input type="checkbox" name="cbGhiNho"/>Ghi Nhớ</td>
		</tr>
		<tr>
			<td colspan="2" align="right">
			<a href="register.php">Đăng kí</a> | Quên mật khẩu? <input type="submit" name="btnDangNhap" value="Đăng Nhập" />
			</td>
		</tr>
  </table>
</form>

<?php
	}
	else{
		$user = unserialize($_SESSION['user']);
		$role = $user->getRole();
		switch($role)
		{
			case 'Admin':
				echo "Xin chào ".$user->getTenDangNhap();
				include("inc/incDangXuat.php");
				echo "<br />";
				?>
					==><a href="QuanLy/Quanly.php">Đến trang quản lý</a>
				<?php
				break;
			case 'Seller':
				echo "Xin chào ".$user->getTenDangNhap();
				include("inc/incDangXuat.php");
				echo "<br />";
				?>
					==> <a href="QuanLy/Quanly.php">Đến trang quản lý</a>
				<?php
				break;
			case 'Buyer':
				echo "Xin chào ".$user->getTenDangNhap();
				?>&nbsp;|&nbsp;
				<a href="index.php?act=7">
					<img src="img/manage_shopping.png" width="24" height="24" />    
				</a>
				(<?php  
					if(isset($_SESSION["MaSanPham"]) == false)
						echo 0;
					else
						echo count($_SESSION["MaSanPham"]);
				?>)
				<?php
				
				include("inc/incDangXuat.php");
				break;
		}
	}
?>